//
//  SearchBarView.m
//  网络FM
//
//  Created by dlios on 15/6/1.
//  Copyright (c) 2015年 dengzhicheng.com. All rights reserved.
//

#import "SearchBarView.h"

@implementation SearchBarView



- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        [self createView];
    }
    return self;
}


- (void)createView
{
    float width = self.frame.size.width;
    float height = self.frame.size.height;
    
    self.clipsToBounds = YES;
    self.layer.borderWidth = 1;
    self.layer.borderColor = [UIColor lightGrayColor].CGColor;
    [self setBackgroundColor:[UIColor whiteColor]];
    self.layer.cornerRadius = height / 2;
    
    
    _search = [[UITextField alloc]initWithFrame:CGRectMake(0, 0,width - height * 3, height)];
    [_search setBackgroundColor:[UIColor clearColor]];
    [_search setCenter:CGPointMake(width / 2, height / 2)];
    [_search setKeyboardType:UIKeyboardTypeWebSearch];
    _search.placeholder = @"请输入主播名 / 场景 ";

    [self addSubview:_search];
    [_search release];
    
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, height- 5  , height - 5)];
    [image setCenter:CGPointMake(height,height / 2)];
    image.layer.cornerRadius = height  / 2;
    image.clipsToBounds = YES;
    [image setImage:[UIImage imageNamed:@"font-search.png"]];
    [self addSubview: image];
    [image release];
}

@end
